﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="EmployeeDetail.ascx.cs" Inherits="AGR.Web.Controls.Form.DetailForm.EmployeeDetail" %>
<link href="../../../Content/CSS/Controls.css" rel="stylesheet" type="text/css" />

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>

<%@ Register TagPrefix="uc" TagName="Message" Src="~/Controls/Message/Message.ascx" %>

<div>
    <asp:UpdatePanel ID="EmployeeDetailUpdatePanel" runat="server" UpdateMode="Conditional">
    <ContentTemplate>

        <div style="width: 810px">
            <uc:Message ID="ucMessage" runat="server" />
        </div>

        <table class="form-border-large">
            <tr>
                <td>Employee code:</td>
                <td>
                    <asp:TextBox ID="txtEmployeeCode" runat="server" TabIndex="1" ReadOnly="true"></asp:TextBox>
                </td>
                <td>Physical address:</td>
                <td rowspan="3">
                    <textarea id="txtPhysicalAddress" runat="server" class="textarea-address" cols="20" rows="4" tabindex="10" readonly="true"></textarea>
                </td>
            </tr>
            <tr>
                <td>First name:</td>
                <td>
                    <asp:TextBox ID="txtFirstName" runat="server" TabIndex="2" ReadOnly="true"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>Last name:</td>
                <td>
                    <asp:TextBox ID="txtLastName" runat="server" TabIndex="3" ReadOnly="true"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>ID number:</td>
                <td>
                    <asp:TextBox ID="txtIdNumber" runat="server" TabIndex="4" ReadOnly="true"></asp:TextBox>
                </td>
                <td>Postal address:</td>
                <td rowspan="4">
                    <textarea id="txtPostalAddress" runat="server" class="textarea-address" cols="20" rows="4" tabindex="11" readonly="true"></textarea>
                </td>
            </tr>
            <tr>
                <td>Gender</td>
                <td>
                    <asp:TextBox ID="txtGender" runat="server" TabIndex="5" ReadOnly="true"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>HireDate</td>
                <td>
                    <asp:TextBox ID="txtHireDate" runat="server" TabIndex="6" ReadOnly="true"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>Type:</td>
                <td>
                    <asp:TextBox ID="txtType" runat="server" TabIndex="7" ReadOnly="true"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>Trainer:</td>
                <td>
                    <asp:CheckBox ID="chkIsTrainer" runat="server" TabIndex="8" Enabled="false" /> 
                </td>
            </tr>
            <tr>
                <td>    
                    <asp:Label ID="lblTrainerSpecialization" Visible="false" runat="server" Text="Specialization:" Enabled="false"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtTrainerSpecialization" Visible="false" runat="server" TabIndex="9" ReadOnly="true"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td colspan="4"><hr /></td>
            </tr>
            <tr>
                <td>Date Created:</td>
                <td>
                    <asp:TextBox ID="txtDateCreated" runat="server" TabIndex="12" ReadOnly="true"></asp:TextBox>
                </td>
                <td>User Created:</td>
                <td>
                    <asp:TextBox ID="txtUserCreated" runat="server" TabIndex="13" ReadOnly="true"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>Date Modified:</td>
                <td>
                    <asp:TextBox ID="txtDateModified" runat="server" TabIndex="14" ReadOnly="true"></asp:TextBox>
                </td>
                <td>User Modified:</td>
                <td>
                    <asp:TextBox ID="txtUserModified" runat="server" TabIndex="15" ReadOnly="true"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td colspan="4"><hr /></td>
            </tr>
            <tr>
                <td colspan="4">
                    
                    <p>
                        Lectures:
                    </p>
                    <div>
                        <asp:Button ID="btnAdd" runat="server" Text="Add" CssClass="button" 
                            onclick="btnAdd_Click" />
                        <asp:Button ID="btnDelete" runat="server" Text="Remove" CssClass="button" 
                            onclick="btnDelete_Click"/>
                    </div>
                    <br />

                    <asp:GridView ID="LectureGridView" runat="server" CssClass="table-grid" AlternatingRowStyle-CssClass="odd" FooterStyle-CssClass="table-grid-footer"
                        EmptyDataRowStyle-CssClass="empty" EmptyDataText="No lectures found." PagerStyle-CssClass="pager"
                        DataKeyNames="CourseCode, SubjectCode"
                        OnRowCommand="LectureGridView_OnRowCommand"
                        OnRowEditing="LectureGridView_RowEditing" 
                        OnRowCancelingEdit="LectureGridView_RowCancelingEdit"
                        OnPageIndexChanging="LectureGridView_PageIndexChanging"
                        AutoGenerateColumns="False"
                        AllowPaging="True" PageSize="3">
                        <PagerSettings Mode="NumericFirstLast" Position="Bottom"/>
                        <Columns>
                            <asp:TemplateField HeaderText="Select" HeaderStyle-Width="40px" 
                             HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" FooterStyle-HorizontalAlign="Center">
                                <ItemTemplate>
                                    <asp:CheckBox ID="chkSelect" runat="server" CausesValidation="False"> </asp:CheckBox>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:CheckBox ID="chkSelect" runat="server" Enabled="false" CausesValidation="False"> </asp:CheckBox>
                                </EditItemTemplate>
                                <FooterTemplate>
                                    <strong>Add</strong>
                                </FooterTemplate>
                            </asp:TemplateField>

                            <asp:TemplateField HeaderText="Options" HeaderStyle-Width="80px" HeaderStyle-HorizontalAlign="Center">
                                <ItemTemplate>
                                    <asp:LinkButton ID="lnkLectureEdit" runat="server" CausesValidation="False" CommandName="Edit" Text="Edit" />
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:LinkButton ID="lnkLectureCancel" runat="server" CausesValidation="False"  CommandName="Cancel" Text="Cancel"></asp:LinkButton>
                                    &nbsp;
                                    <asp:LinkButton ID="lnkLectureUpdate" runat="server" CausesValidation="True" CommandName="Update" Text="Update"
                                        ValidationGroup="LectureUpdateValidationGroup"></asp:LinkButton>
                                </EditItemTemplate>
                                <FooterTemplate>
                                    <asp:LinkButton ID="btnLectureCancel" runat="server" Text="Cancel" CausesValidation="false" UseSubmitBehavior="false" CommandName="CancelInsert" />
                                    &nbsp;
                                    <asp:LinkButton ID="btnLectureInsert" runat="server" Text="Save" UseSubmitBehavior="false" CommandName="Insert"
                                        ValidationGroup="LectureSaveValidationGroup" />
                                </FooterTemplate>
                            </asp:TemplateField>

                            <asp:TemplateField HeaderText="Course Code" HeaderStyle-Width="90px" >
                                <ItemTemplate><%# Eval("CourseCode")%></ItemTemplate>
                                <EditItemTemplate>
                                    <span style="font-size:smaller">Select course:</span>
                                </EditItemTemplate>
                                <FooterTemplate>
                                    <span style="font-size:smaller">Select course:</span>
                                </FooterTemplate>
                            </asp:TemplateField>

                            <asp:TemplateField HeaderText="Course" HeaderStyle-Width="90px">
                                <ItemTemplate><%# Eval("CourseTitle")%></ItemTemplate>
                                <EditItemTemplate>
                                    <asp:DropDownList ID="ddlCourseTitle" runat="server"/>
                                </EditItemTemplate>
                                <FooterTemplate>
                                    <asp:DropDownList ID="ddlCourseTitle" runat="server"/>
                                </FooterTemplate>
                            </asp:TemplateField>
                            
                            <asp:TemplateField HeaderText="Subject Code" HeaderStyle-Width="70px">
                                <ItemTemplate><%# Eval("SubjectCode")%></ItemTemplate>
                                <EditItemTemplate>
                                    <span style="font-size:smaller">Select subject:</span>
                                </EditItemTemplate>
                                <FooterTemplate>
                                    <span style="font-size:smaller">Select subject:</span>
                                </FooterTemplate>
                            </asp:TemplateField>

                            <asp:TemplateField HeaderText="Subject" HeaderStyle-Width="90px">
                                <ItemTemplate><%# Eval("SubjectTitle")%></ItemTemplate>
                                <EditItemTemplate>
                                    <asp:DropDownList ID="ddlSubjectTitle" runat="server" />
                                </EditItemTemplate>
                                <FooterTemplate>
                                    <asp:DropDownList ID="ddlSubjectTitle" runat="server" />
                                </FooterTemplate>
                            </asp:TemplateField>

                        </Columns>
                        <PagerStyle HorizontalAlign="Right" Wrap="False" />
                    </asp:GridView>
                </td>
            </tr>
            
        </table>

    </ContentTemplate>
    </asp:UpdatePanel>

    <asp:UpdateProgress ID="EmployeeDetailUpdateProgress" runat="server" AssociatedUpdatePanelID="EmployeeDetailUpdatePanel">
    <ProgressTemplate>
        <div class="modalpopup">
            <div class="loadingpopup">
            <p>
                <img src="<%=ResolveUrl("~/Content/Images/Shared/spinner.gif") %>" alt="loading..." /> Loading...
            </p>
            </div>
        </div>
    </ProgressTemplate>
    </asp:UpdateProgress>
</div>